<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - iris.info - MemCtrl/cmd_issuer.h</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">MemCtrl</a> - cmd_issuer.h</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>iris.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2010-05-24</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">26</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">92.3 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">24</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :  * =====================================================================================
<span class="lineNum">       3 </span>                :  *
<span class="lineNum">       4 </span>                :  *       Filename:  cmd_issuer.h
<span class="lineNum">       5 </span>                :  *
<span class="lineNum">       6 </span>                :  *    Description:  
<span class="lineNum">       7 </span>                :  *
<span class="lineNum">       8 </span>                :  *        Version:  1.0
<span class="lineNum">       9 </span>                :  *        Created:  02/21/2010 09:41:49 PM
<span class="lineNum">      10 </span>                :  *       Revision:  none
<span class="lineNum">      11 </span>                :  *       Compiler:  gcc
<span class="lineNum">      12 </span>                :  *
<span class="lineNum">      13 </span>                :  *         Author:  SYED MINHAJ HASSAN
<span class="lineNum">      14 </span>                :  *        Company:  Georgia Institute of Technology
<span class="lineNum">      15 </span>                :  *
<span class="lineNum">      16 </span>                :  * =====================================================================================
<span class="lineNum">      17 </span>                :  */
<span class="lineNum">      18 </span>                : 
<span class="lineNum">      19 </span>                : #ifndef  cmd_issuer_h_INC
<span class="lineNum">      20 </span>                : #define  cmd_issuer_h_INC
<span class="lineNum">      21 </span>                : 
<span class="lineNum">      22 </span>                : #include        &lt;string&gt;
<span class="lineNum">      23 </span>                : #include        &lt;sstream&gt;
<span class="lineNum">      24 </span>                : #include        &lt;iostream&gt;
<span class="lineNum">      25 </span>                : #include        &lt;cstdlib&gt;
<span class="lineNum">      26 </span>                : #include        &lt;map&gt;
<span class="lineNum">      27 </span>                : #include        &quot;../kernel/component.h&quot;
<span class="lineNum">      28 </span>                : #include        &quot;../kernel/simulator.h&quot;
<span class="lineNum">      29 </span>                : #include        &quot;../data_types/impl/irisEvent.h&quot;
<span class="lineNum">      30 </span>                : #include        &quot;../MemCtrl/request.h&quot; 
<span class="lineNum">      31 </span>                : //#include      &quot;../MemCtrl/bus_handler.h&quot;
<span class="lineNum">      32 </span>                : #include        &quot;../MemCtrl/data_bus_handler.h&quot;
<span class="lineNum">      33 </span>                : #include        &quot;../MemCtrl/cmd_bus_handler.h&quot;
<span class="lineNum">      34 </span>                : #include        &quot;../MemCtrl/constants.h&quot;
<span class="lineNum">      35 </span>                : 
<span class="lineNum">      36 </span>                : using namespace std;
<span class="lineNum">      37 </span>                : 
<span class="lineNum">      38 </span>                : enum DRAMCmd {READ, WRITE, PRECHARGE, ACTIVATE, ALL_BANK_REFRESH};
<span class="lineNum">      39 </span>                : typedef DRAMCmd DRAMCmd;
<span class="lineNum">      40 </span>                : 
<span class="lineNum">      41 </span>                : enum BurstLength {READL, WRITEL, PREFETCHL, WRITEBACKL, NORMAL};
<span class="lineNum">      42 </span>                : typedef BurstLength BurstLength;
<span class="lineNum">      43 </span>                : 
<span class="lineNum">      44 </span>                : struct DRAMCmdState
<span class="lineNum">      45 </span>                : {
<span class="lineNum">      46 </span>                :         DRAMCmd cmd;
<span class="lineNum">      47 </span>                :         Request req;
<span class="lineNum">      48 </span>                :         BurstLength burst;
<span class="lineNum">      49 </span><span class="lineCov">         331823 :         void set(DRAMCmd cmdS, BurstLength burstL, Request reqI)</span>
<span class="lineNum">      50 </span>                :         {
<span class="lineNum">      51 </span><span class="lineCov">         331823 :             cmd = cmdS;</span>
<span class="lineNum">      52 </span><span class="lineCov">         331823 :             req = reqI; </span>
<span class="lineNum">      53 </span><span class="lineCov">         331823 :             burst = burstL;</span>
<span class="lineNum">      54 </span>                :             
<span class="lineNum">      55 </span><span class="lineCov">         331823 :             if (burst == READL)</span>
<span class="lineNum">      56 </span><span class="lineCov">          78807 :                 req.data.size = READ_SIZE;      /// TODO needs to set this</span>
<span class="lineNum">      57 </span><span class="lineCov">         331823 :             if (burst == WRITEL)</span>
<span class="lineNum">      58 </span><span class="lineCov">          23654 :                 req.data.size = WRITE_SIZE;</span>
<span class="lineNum">      59 </span><span class="lineCov">         308169 :             else if (burst == PREFETCHL)</span>
<span class="lineNum">      60 </span><span class="lineCov">          46345 :                 req.data.size = PREFETCH_SIZE;</span>
<span class="lineNum">      61 </span><span class="lineCov">         261824 :             else if (burst == WRITEBACKL)</span>
<span class="lineNum">      62 </span><span class="lineCov">           4233 :                 req.data.size = WRITEBACK_SIZE; </span>
<span class="lineNum">      63 </span><span class="lineCov">         331823 :         }</span>
<span class="lineNum">      64 </span><span class="lineCov">       13476654 :         DRAMCmdState () </span>
<span class="lineNum">      65 </span><span class="lineCov">       13476654 :         {</span>
<span class="lineNum">      66 </span><span class="lineCov">       13476654 :             cmd = PRECHARGE;</span>
<span class="lineNum">      67 </span><span class="lineCov">       13476654 :             burst = NORMAL;             </span>
<span class="lineNum">      68 </span><span class="lineCov">       13476654 :         };</span>
<span class="lineNum">      69 </span><span class="lineCov">       54085318 :         ~DRAMCmdState () { };</span>
<span class="lineNum">      70 </span>                : };
<span class="lineNum">      71 </span>                : typedef DRAMCmdState DRAMCmdState;
<span class="lineNum">      72 </span>                : typedef vector&lt;DRAMCmdState&gt; CmdQueue;
<span class="lineNum">      73 </span>                : 
<span class="lineNum">      74 </span>                : enum RankBankComb {SAME, DIFF};
<span class="lineNum">      75 </span>                : 
<span class="lineNum">      76 </span>                : struct BankState
<span class="lineNum">      77 </span>                : {
<span class="lineNum">      78 </span>                :     unsigned long long int prevRow;
<span class="lineNum">      79 </span>                :     DRAMCmd prevCmd;
<span class="lineNum">      80 </span>                :     Time prevCmdTime;
<span class="lineNum">      81 </span><span class="lineNoCov">              0 :     BankState ()</span>
<span class="lineNum">      82 </span>                :     {
<span class="lineNum">      83 </span><span class="lineCov">            128 :         prevRow = 0;</span>
<span class="lineNum">      84 </span><span class="lineCov">            128 :         prevCmd = PRECHARGE;</span>
<span class="lineNum">      85 </span><span class="lineCov">            128 :         prevCmdTime = 0;                </span>
<span class="lineNum">      86 </span><span class="lineNoCov">              0 :     }   </span>
<span class="lineNum">      87 </span>                : };
<span class="lineNum">      88 </span>                : typedef BankState BankState; 
<span class="lineNum">      89 </span>                : 
<span class="lineNum">      90 </span>                : struct RankState
<span class="lineNum">      91 </span><span class="lineCov">            144 : {</span>
<span class="lineNum">      92 </span>                :         BankState bank[NO_OF_BANKS];
<span class="lineNum">      93 </span>                : };
<span class="lineNum">      94 </span>                : typedef RankState RankState;
<span class="lineNum">      95 </span>                : 
<span class="lineNum">      96 </span>                : struct ChannelState
<span class="lineNum">      97 </span><span class="lineCov">             24 : {</span>
<span class="lineNum">      98 </span>                :         RankState rank[NO_OF_RANKS];
<span class="lineNum">      99 </span>                :         unsigned int prevCmdRank;
<span class="lineNum">     100 </span>                :         unsigned int prevCmdBank;
<span class="lineNum">     101 </span>                :         Time prevCmdTime;
<span class="lineNum">     102 </span>                :         DRAMCmdState cmd;
<span class="lineNum">     103 </span>                : };
<span class="lineNum">     104 </span>                : typedef ChannelState ChannelState;
<span class="lineNum">     105 </span>                : 
<span class="lineNum">     106 </span>                : class CmdIssuer : public Component
<span class="lineNum">     107 </span>                : {
<span class="lineNum">     108 </span>                :     public:
<span class="lineNum">     109 </span>                :         CmdIssuer ();                   /*  constructor */
<span class="lineNum">     110 </span>                :         ~ CmdIssuer ();
<span class="lineNum">     111 </span>                :         Component* parent;
<span class="lineNum">     112 </span>                :         DataBusHandler* dataBus;
<span class="lineNum">     113 </span>                :         CmdBusHandler* cmdBus;  
<span class="lineNum">     114 </span>                :         short Id;
<span class="lineNum">     115 </span>                :         short bufferId;
<span class="lineNum">     116 </span>                :         ChannelState prevState;
<span class="lineNum">     117 </span>                :         Time busBusy;
<span class="lineNum">     118 </span>                :         void process_event(IrisEvent* e);
<span class="lineNum">     119 </span>                :         bool HasWork();
<span class="lineNum">     120 </span>                :         std::string toString();
<span class="lineNum">     121 </span>                : 
<span class="lineNum">     122 </span>                :         bool IssueCmd(bool *isWrite, DRAMCmdState *scheduledCmd);
<span class="lineNum">     123 </span>                :         bool BankNotBusy(DRAMCmdState currentCmd);
<span class="lineNum">     124 </span>                :         bool BanksFirstReq(DRAMCmdState currentCmd, unsigned int index);
<span class="lineNum">     125 </span>                :         bool BusNotBusy(DRAMCmdState currentCmd);
<span class="lineNum">     126 </span>                :         bool CanSchedule(DRAMCmdState currentCmd, DRAMCmdState prevCmd);
<span class="lineNum">     127 </span>                :         void SetBusBusyTime(DRAMCmdState currentCmd);
<span class="lineNum">     128 </span>                :         Time CmdDelay(DRAMCmd cmd);
<span class="lineNum">     129 </span>                :         Time CalculateDataDelay(DRAMCmdState cmdS);
<span class="lineNum">     130 </span>                :         Time CalculateBurstL(DRAMCmdState prevCmd);
<span class="lineNum">     131 </span>                :         Time CalculateBusyTime(DRAMCmd curCmd, DRAMCmd prevCmd, RankBankComb rankC, RankBankComb bankC, Time prevBurstL);
<span class="lineNum">     132 </span>                :         void SetPrevState(DRAMCmdState currentCmd);
<span class="lineNum">     133 </span>                :         Time Max(Time t1, Time t2);
<span class="lineNum">     134 </span>                :         bool generated_start_event;
<span class="lineNum">     135 </span>                :                                                                             
<span class="lineNum">     136 </span>                :     protected:
<span class="lineNum">     137 </span>                :                                                                             
<span class="lineNum">     138 </span>                :     private:
<span class="lineNum">     139 </span>                :                                                                             
<span class="lineNum">     140 </span>                : }; /*  -----  end of class CmdIssuer  ----- */
<span class="lineNum">     141 </span>                : 
<span class="lineNum">     142 </span>                : #endif   /*  ----- #ifndef cmd_issuer_INC  ----- */
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
